const path = require('path');

function resolve(dir) {
    return path.join(__dirname, dir);
}

module.exports = {
    // ‘/’ 换成项目的路径，访问静态文件
    publicPath: '/',
    productionSourceMap: process.env.NODE_ENV === 'production' ? false : true,
    lintOnSave: true,
    chainWebpack: (config) => {
        config.resolve.alias
            .set('vue$', 'vue/dist/vue.esm.js')
            .set('@', resolve('src'))
            .set('components', resolve('src/components'))
            .set('assets', resolve('src/assets'))
            .set('utils', resolve('src/utils'))
            .set('base', resolve('src/base'))
            .set('api', resolve('src/api'))
    },
    css: {
        sourceMap: true, // 开启 CSS source maps
        loaderOptions: {
            less: {
                javascriptEnabled: true,
            },
            stylus: {
                // import: path.resolve(__dirname, './src/styles/global.styl')
            }
        }
    },
};

